
/// 考勤组模块
/// 

use poem_openapi::{payload::Json, Tags, ApiResponse, Object};

#[derive(Tags)]
pub enum ApiTags {
    /// 获取打卡信息接口的入参格式
    AttGroupInfoRequest,
}

/// 创建打卡入参模式
#[derive(Debug, Object, Clone, Eq, PartialEq)]
pub struct AttGroupInfoRequest {

    /// 用户编号
    #[oai(max_length = 64)]
    pub group_id: String,

    /// 考勤时间
    // #[oai(max_length = 64)]
    // pub group_name: Option<String>,  

}

/// ## 考勤对象
#[derive(Debug, Object, Clone, PartialEq)]
pub struct AttTraget {
    /// ### 考勤对象类别
    /// - dept：部门组织
    /// - staff: 人员 
    #[oai(max_length = 64)]
    pub target_type: String,

    /// ### 值code；当target_type分别dept和staff时 code分别为部门code和user_code
    /// - target_type = "dept"  target_code = org_id
    /// - target_type = "staff" target_code = user_code 
    #[oai(max_length = 64)]
    pub target_code: String,

    /// ### 值name；当target_type分别dept和staff时 code分别为部门name和user_name
    /// - target_type = "dept"  target_name = org_name
    /// - target_type = "staff" target_name = user_name     
    #[oai(max_length = 64)]
    pub target_name: String,    

}

type UserCode = String;

/// 班次信息详情
#[derive(Debug, Object, Clone, PartialEq)]
pub struct AttGroupInfo {
    /// 考勤组id
    #[oai(max_length = 64)]
    pub group_id: Option<String>,

    /// 
    #[oai(max_length = 64)]
    pub group_name: String,

    /// 考勤组类别 
    /// - 1：固定班制
    /// - 2：排班制
    /// - 3：自由班制(不支持)
    #[oai(maximum(value = "3"))]
    pub attendance_mode: u8,

    /// 考勤对象
    #[oai()]
    pub attendance_target: Vec<AttTraget>,

    /// 不参与考勤的对象
    #[oai()]
    pub attendance_not_target: Vec<AttTraget>,  
    
    // 考勤组管理员
    #[oai()]
    pub att_manager: Vec<UserCode>,

    /// 
    #[oai(max_length = 64)]
    pub work_calendar_id: String,

    /// 
    #[oai(max_length = 64)]
    pub work_calendar_name: String,

    


}





#[derive(ApiResponse)]
pub enum AttGroupInfoResponse {

    #[oai(status = 200)]
    Ok(Json<AttGroupInfo>),

    #[oai(status = 400)]
    NotFound
}